import { PageTool } from "../../../common/global/PageTool";
import { DataProvider } from "../../../../fl/data/DataProvider";
import { ObjCreate } from "../common/ObjCreate";
import { ScrollPolicy } from "../../../../fl/controls/ScrollPolicy";
import { PetIslandRecordInfoItemRenderer } from "./renderer/PetIslandRecordInfoItemRenderer";
import { PageSelecter } from "../common/pageSelect/PageSelecter";
import { GTileList } from "../../../../com/mui/controls/GTileList";
//class PetIslandRecordPanel
    
    export  class PetIslandRecordPanel /* flash.display.Sprite */
    {
        constructor()
        {
            
            this._pageTool = new PageTool([], 10);
            this.init();
            return;
        }

        /* internal  */onEquipmentPageChange(arg1: Object /* flash.events.Event */=null): void
        {
            var loc1=this._pageSelecter.currentPage;
            this._list.dataProvider = new DataProvider(this._pageTool.getByPageNo(loc1));
            this._list.drawNow();
            return;
        }

        public set data(arg1: Array<any>)
        {
            this._pageTool.array = arg1;
            this._pageSelecter.currentPage = this._pageTool.currentPage;
            this._pageSelecter.maxPage = this._pageTool.pagesCount;
            this._list.dataProvider = new DataProvider(this._pageTool.getByPageNo(this._pageSelecter.currentPage));
            this._list.drawNow();
            return;
        }

        /* internal  */init(): void
        {
            this._list = ObjCreate.createTileList(0, 20, 550, 405, this);
            this._list.scrollPolicy = ScrollPolicy.OFF;
            this._list.columnWidth = 530;
            this._list.rowHeight = 40;
            this._list.setStyle("cellRenderer", PetIslandRecordInfoItemRenderer);
            this._pageSelecter = ObjCreate.createPageSelecter(200, 467, this);
            this._pageSelecter.mode = PageSelecter.CompleteMode;
            this._pageSelecter.addEventListener(flash.events.Event.CHANGE, this.onEquipmentPageChange);
            return;
        }

        /* internal */ /* var */_list: GTileList;

        /* internal */ /* var */_pageSelecter: PageSelecter;

        /* internal */ /* var */_pageTool: PageTool;
    }
